<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">

<head>
  <title></title>
  <meta charset="utf-8">
  <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  <link rel="stylesheet" href="css/fonts/font-awesome.min.css">
  <link rel="stylesheet" href="css/ui-box.css">
  <link rel="stylesheet" href="css/ui-base.css">
  <link rel="stylesheet" href="css/ui-color.css">
  <link rel="stylesheet" href="css/appcan.icon.css">
  <link rel="stylesheet" href="css/appcan.control.css">
  <link rel="stylesheet" href="css/media.css">
  <link rel="stylesheet" href="css/base.css">
</head>
<style>
  .bdr {
    border: 1px solid red;
  }

  .bdr_btm {
    border-bottom: 1px solid #3EC5F7;
  }

  .bdr_btm_w {
    border-bottom: 1px solid white;
  }

  .bc_8EC2DA {
    background: #8EC2DA;
  }

  .bcred {
    background: red;
  }

  .bcwhite {
    background: white;
  }

  .cwhite {
    color: white;
  }

  .c4892AA {
    color: #4892AA;
  }

  .bdr-t {
    border: .7em solid transparent;
    border-bottom-color: white;
    position: absolute;
    right: .9em;
    top: -.5em;
  }

  #search_wrap {
    position: fixed;
    z-index: 9999;
    width: 100%;
    height: 100%;
    background-color: rgba(230, 230, 230, 0.6);
    display: none;
  }

  #list_wrap {

    background: white;
    margin: .8em auto;
    border-radius: .4em;
  }

  .bdr_b {
    border: 1px solid black;
    border-radius: .2em;
  }

  #query {
    width: 5em;
    height: 2em;
    background: #6FCAE9;
    color: white;
    border-radius: .3em;
    border: none;
  }

  #select_wrap {
    background-image: url("./images/xia.png");
    background-repeat: no-repeat;
    background-position: 95%;
    position: relative;
    background-size: 15%;
  }

  #options {
    display: none;
  }

  .bdr {
    border: 1px solid black;
  }

  .imgjj {
    width: 10%;
    background-image: url("images/zy_jk.png");
    background-size: 60%;
    background-repeat: no-repeat;
    background-position: center;
  }

  .bs-lf {
    -webkit-box-shadow: 0.2em 0 0.2em #D7DBDD;
    z-index: 999;
  }

  .bs-bt {
    -webkit-box-shadow: 0 0.3em 0.3em #CECECE;
    z-index: 999;
  }
</style>

<body style="background:white" class="um-vp" ontouchstart>
  <div id="page_0" class="up ub ub-ver" tabindex="0">
    <div id="content">
      <!-- 搜索框开始-->
      <div id="search_wrap">
        <div class="bdr-t"></div>
        <div class="wtp95 bs-bt" id="list_wrap">
          <div class="ub ub-pc pt10">
            <div class="mr10 lh15">机场三字码</div>
            <div id="szm" class="w80 bdr_b tx-c h15 lh15"></div>
          </div>
          <div class="ub ub-pc pt10">

            <div class="mr10 lh15">&nbsp;&nbsp;&nbsp;修改状态</div>
            <div id="select_wrap" class="w80 bdr_b tx-c h15 lh15">
              <span id="txtSelect">请选择</span>
              <div id="options" class="w80" style="position:absolute;z-index:9999;top:1.6em;background:white;border-bottom-right-radius:.2em;
border-bottom-left-radius:.2em;">
                <div class="op">请选择</div>
                <div class="op">未确认</div>
                <div class="op">已确认</div>
              </div>
            </div>
          </div>
          <div class="ub ub-pc pt10 pb10">
            <button id="query" type="button" class="fs10">查询</button>
          </div>

        </div>

      </div>
      <!--header start-->
      <div id="header" class="ub">
        <div class="lh25 h25 w35 tx-c bdr_btm_w bc_8EC2DA cwhite fs11 bs-lf">
          公司
        </div>
        <div class="ub-f1 bdr_btm lh27 bcwhite c4892AA">
          <div class="ub tx-c fs9 wtp90">
            <div class="ub-f1">城市/机场</div>
            <div class="ub-f1">所属部门</div>
            <div class="ub-f1">修改状态</div>
          </div>
        </div>
      </div>
      <!--header finish-->
      <!-- 列表开始 -->
      <ul id="datalist_wrap" style="height: 100%;border: 0px solid;">

      </ul>
      <!--列表结束-->
    </div>
  </div>
</body>
<script src="js/appcan.js"></script>
<script src="js/appcan.control.js"></script>
<script src="js/common.js"></script>
<script src="js/talkingdata.js"></script>
<script>
  appcan.ready(function() {
    var $headerHeight = $("#header").css("height");
    var page_ = $("#page_0").css("height");

    $("#content").css("height", page_ - $headerHeight);
    pullToRefresh_loadMore(onPullToRefresh, onUpToLoadMore); //初始化上拉刷新 下拉加载
    appcan.window.disableBounce(); //关闭弹动
  });

  /*
   * 服务器地址
   * http://172.31.64.34:8011/sdk10098/public/                       测试地址
   * var h_yddfUrl="http://172.31.65.220:8081/sdk10098/public/       UAT地址
   * http://store.ceair.com/mas/sdk10098/public/;                   生产地址
   */
  var http = h_yddfUrl+"yddfMAS/";
  var isShow = false;
  $("#select_wrap").click(function() {
    IC.talkingDataCount("天合优享","0011");
    if (isShow == false) {
      $("#options").css("display", "block");
      isShow = true;
    } else {
      $("#options").css("display", "none");
      isShow = false;
    }

  });

  $("#szm").click(function() {
    IC.talkingDataCount("天合优享","0011");
    var evaluate = {};
    evaluate.windowName = "TianHe"; //root TianHe
    evaluate.popName = "content"; //
    evaluate.pageName = "";
    evaluate.type = 1;
    appcan.locStorage.setVal("evaluateObj", JSON.stringify(evaluate));
    appcan.window.open('LCairport_select1', 'LCairport_select1.html', '2', '4', 0, 0, 200);
  });

  function setAirPort(airPort) {
    $("#szm").text(airPort);
  }

  //下拉框选择
  $(".op").click(function() {
    IC.talkingDataCount("天合优享","0011");
    $("#txtSelect").text(this.innerHTML);
  });

  //显示/隐藏搜索框
  var isSearchShow = false;
  function setSearchShow() {

    if (isSearchShow == false) {
      $("#search_wrap").css("display", "block");
      isSearchShow = true;
    } else {
      $("#search_wrap").css("display", "none");
      isSearchShow = false;
    }
  }

  //查询数据方法
  var txtSelectv, szm;
  $("#query").click(function() {
    IC.talkingDataCount("天合优享","0011");
    appcan.window.enableBounce(); //开始弹动
    uexWindow.toast(1, 5, "正在查询...", -1);
    curPage = 1; //每次查询时初始化条目
    szm = $("#szm").text();
    txtSelect = $("#txtSelect").text();
    if (szm == "" || szm == undefined || szm == "undefined" || szm == null || szm == "null") {
      szm = "";
    }
    if (txtSelect == "请选择") {
      uexWindow.closeToast();
      alertts("提示","请选择状态","确定");
      return;
    }

    $.ajax({
      url: http+"zyh_querySpInfos",
      type: "POST",
      dataType: "JSON",
      data: {
        userName: 'wangying69',
        airportCode: szm,
        status: txtSelect,
        curPage: "0",
        pageSize: "10"
      },
      success: function(res) {
        res = JSON.parse(res);
        var data = JSON.parse(res.querySpInfos);
        callBackQuerySpInfos(data.spInfos, 0); //请求成功后回调
      },
      error: function(err) {
        console.log(err);
      }
    });

  });

  function callBackQuerySpInfos(data, type) {
    IC.talkingDataCount("天合优享","0011");
    if (data.length <= 0) {
      uexWindow.closeToast();
      $('#datalist_wrap').html('<div style="padding-top: 1em; text-align:center;">暂时没有据...</div>');
      $("#search_wrap").css("display", "none");
      isSearchShow = false;
      appcan.window.disableBounce();
      return;
    }
    var tpl = "";
    data.forEach(function(item) {
      tpl += '<li>' +
        '<div class="ub">' +
        '<div class="fs11 bc_8EC2DA cwhite bdr_btm_w h25 lh25 w35 tx-c bs-lf">' + item.carrier + '</div>' +
        '<div class="ub-f1 lh27 bdr_btm item_wrap" carrier="' + item.carrier + '" companyName="' + item.companyName + '" portCode3="' + item.portCode3 + '" portName="' + item.portName + '" checkInPrior="' + item.checkInPrior +
        '" resigLuggPrior="' + item.resigLuggPrior + '" inspectPrior="' + item.inspectPrior + '" inspectHchannel="' + item.inspectHchannel + '" safeInspectPrior="' + item.safeInspectPrior + '" safeInspectHchannel="' + item.safeInspectHchannel +
        '" ticketPrior="' + item.ticketPrior + '" transferPrior="' + item.transferPrior + '" boardingPrior="' + item.boardingPrior + '" extractLuggPrior="' + item.extractLuggPrior + '" searLuggPrior="' + item.searLuggPrior + '" status="' + item.status +
        '" Remark="' + item.remark + '">' +
        '<div class="ub">' +
        '<div class="ub fs9 wtp90">' +
        '<div class="wtp33 tx-c c4892AA">' + item.portName + '</div>' +
        '<div class="wtp36 tx-c c4892AA">' + item.companyName + '</div>' +
        '<div class="ub-f1 tx-c c4892AA">' + item.status + '</div>' +
        '</div>' +
        '<div class="imgjj"></div>' +
        '</div>' +
        '</div>' +
        '</div>' +
        '</li>';
    });

    if (type == 0) {
      $("#datalist_wrap").html(tpl);
    } else {
      $("#datalist_wrap").append(tpl);
    }
    $("#search_wrap").css("display", "none");
    isSearchShow = false;
    uexWindow.closeToast();
    $(".item_wrap").click(function() {
      IC.talkingDataCount("天合优享","0011");
      var TH = Object();
      TH.carrier = $(this).attr("carrier"); //承运人
      TH.companyName = $(this).attr("companyName"); //所属分子公司
      TH.portCode3 = $(this).attr("portCode3"); //三字码
      TH.portName = $(this).attr("portName"); //城市机场
      TH.checkInPrior = $(this).attr("checkInPrior"); //是否优先值机
      TH.resigLuggPrior = $(this).attr("resigLuggPrior"); //是否行李托运优先
      TH.inspectPrior = $(this).attr("inspectPrior"); //是否优先边检
      TH.inspectHchannel = $(this).attr("inspectHchannel"); //边检快速道用适通情况
      TH.safeInspectPrior = $(this).attr("safeInspectPrior"); //是否优先安检
      TH.safeInspectHchannel = $(this).attr("safeInspectHchannel"); //安检快速速道用适通情况
      TH.ticketPrior = $(this).attr("ticketPrior"); //是否优先票台
      TH.transferPrior = $(this).attr("transferPrior"); //是否优先中转柜台
      TH.boardingPrior = $(this).attr("boardingPrior"); //是否优先登机
      TH.extractLuggPrior = $(this).attr("extractLuggPrior"); //是否优先提取行李
      TH.searLuggPrior = $(this).attr("searLuggPrior"); //是否优先行李查询
      TH.status = $(this).attr("status"); //状态
      TH.Remark = $(this).attr("Remark"); //备注
      appcan.locStorage.setVal("THinfo", JSON.stringify(TH));
      appcan.window.open({
        name: "TianHeDetail",
        dataType: 0,
        aniId: 5,
        data: "TianHe_Detail.html",
      });
    });
  }


  //下拉刷新,上推加载
  function pullToRefresh_loadMore(funcTop, funcBottom) {

    appcan.window.setBounce({
      bounceType: [0, 1], //弹动的类型,如果为多个请用数组,0：向下拖动，1:向上拖动;
      startPullCall: function(type) { //开始滑动时触发回调

      },
      downEndCall: function(type) { //上拉超过边界或者下拉执行回调

      },
      upEndCall: function(type) { //上拉或者下拉,超出边界之后,恢复最初状态执行

        setTimeout(function() {
          appcan.window.resetBounceView(type);
          if (!type) {

            //下拉刷新
            funcTop();
          } else {
            //
            funcBottom();
          }
        }, 1000);
      },
      color: '#f0f0f0', // 如果超出了边界显示的背景颜色
      imgSettings: {

        // 如果超出了边界,并且想要设置 显示的内容包括图片文字则设置该参数
        'imagePath': 'res://shuaxin.png',
        'textColor': '#88c933',
        'pullToReloadText': '拖动刷新...',
        'releaseToReloadText': '释放刷新...',
        "loadingText": '加载中,请稍等...'
      }

    });
  }

  var curPage = 1;

  function onPullToRefresh() {
    IC.talkingDataCount("天合优享","0010");
    curPage = 1;
    loadDataFromServer(0, 10, 0);
  }

  function onUpToLoadMore() {
    IC.talkingDataCount("天合优享","0011");
    var cur = curPage++ * 10;
    loadDataFromServer(cur, 10, 1);
  }

  function loadDataFromServer(curpage, pagesize, type) {
    IC.talkingDataCount("天合优享","0011");
    $.ajax({
      url: http+"zyh_querySpInfos",
      type: "POST",
      dataType: "JSON",
      data: {
        userName: "wangying69",
        airportCode: szm,
        status: txtSelect,
        curPage: curpage,
        pageSize: pagesize
      },
      success: function(res) {
        res = JSON.parse(res);
        var data = JSON.parse(res.querySpInfos);
        if (curpage >= data.count) {
          appcan.window.openToast("列表已经加载完毕", 3000, 5);
          return;
        }
        var tpl = '';
        if (type == 0) {
          if (data.spInfos.length > 0) {
            callBackQuerySpInfos(data.spInfos, type);
          } else {
            $('#datalist_wrap').html('<div style="padding-top: 1em; text-align:center;">暂时没有据...</div>');
            appcan.window.disableBounce();
          }
        } else {
          if (data.spInfos.length > 0) {
            callBackQuerySpInfos(data.spInfos, type);
          }
        }
      },
      error: function(err) {
        alert("网络错误");
      }
    });
  }
  function alertts(t, c, b) {
      IC.talkingDataCount("天合优享","0009");
      appcan.window.alert({
          title : t,
          content : c,
          buttons : b
      });
  }
</script>

</html>
